﻿package com.truckdispatching.map;

import android.content.Context;

import com.baidu.mapapi.BMapManager;
import com.baidu.mapapi.MKGeneralListener;

public class BaiduMapManager {

	private static BaiduMapManager mInstance = null;
	public BMapManager mBMapManager = null;

	private final String MapKey = "FCB178C98B4FAC116F04FFB6809A973A5B34E7BB";

	public static BaiduMapManager getInstance() {
		if (mInstance == null) {
			mInstance = new BaiduMapManager();
		}
		return mInstance;
	}

	// 建议在您app的退出之前调用mapadpi的destroy()函数，避免重复初始化带来的时间消耗
	public void destroy() {
		if (mBMapManager != null) {
			mBMapManager.destroy();
			mBMapManager = null;
		}
	}

	public boolean initBaiduMapManagerWithContext(Context context) {
		if (mBMapManager == null) {
			mBMapManager = new BMapManager(context);
			
		}
		return mBMapManager.init(MapKey, new MKGeneralListener() {
			
			@Override
			public void onGetPermissionState(int arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onGetNetworkState(int arg0) {
				// TODO Auto-generated method stub
				
			}
		});
	}
}